
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>环境搭建与项目初始化 · 开源鸿蒙跨平台开发教程</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="坚果派">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-pageview-count/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-mind-maps/mindmaps.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-emphasize/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchors/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-ace/ace.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-theme-lou/lou.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../styles/website.css">
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="鸿蒙适配指南.html" />
    
    
    <link rel="prev" href="../chapter2/实战案例与发布.html" />
    

    <style>
    @media only screen and (max-width: 640px) {
        .book-header .hidden-mobile {
            display: none;
        }
    }
    </style>
    <script>
        window["gitbook-plugin-github-buttons"] = {"repo":"ITmxs/gitbook","types":["star","watch","fork"],"size":"small"};
    </script>

    </head>
    <body>
         
<div class="donate-modal modal">
  <div class="modal-header">
    <div>
      <span>
        <img
          id="modal-avatar"
          class="modal-avatar"
          src="http://xkapp-uat.oss-cn-hangzhou.aliyuncs.com/2e7a3f70-80ab-4b50-93ec-a04dfeef949b/avatar-100.png"
        />
      </span>
      <span id="nickname"> breeze </span>
      <p class="modal-close close" onclick="closeDonateModal()">×</p>
    </div>
    <div class="message">
      <div class="tip">
        <i></i>
        <span>随意打赏，但不要超过一顿早餐钱 💕</span>
      </div>
    </div>
  </div>
  <div class="modal-content">
    <div class="modal-pay-way">
      <div id="wxpay" onclick="showDonateImg(0)">
        <input
          type="radio"
          name="pay-way"
          value="wxpay"
          class="zs-type"
          checked="checked"
        />
        <span>
          <img
            id="wxpay-logo"
            src=""
          />
        </span>
      </div>
      <div id="alipay" onclick="showDonateImg(1)">
        <input type="radio" name="pay-way" value="alipay" class="zs-type" />
        <span>
          <img
            id="alipay-logo"
            src=""
          />
        </span>
      </div>
    </div>
    <div class="modal-pay-qrcode">
      <img id="wxpay-code" src="https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210922202901895.png" />
      <img
        id="alipay-code"
        src="https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210922202843746.png"
        hidden
      />
    </div>
  </div>
</div>
<div class="mask"></div>


<div class="book">
  <div class="header-inner">
    <!-- LOGO -->
    <div class="logo"></div>
    <span class="title"></span>

    <!-- Search -->
    
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>


    <!-- Nav -->
    <ul class="header-nav">
      <li>
        <a href="https://www.nutpie.net/" target="_blank">坚果派官网</a>
      </li><li>
        <a href="https://www.npmjs.com/package/package" target="_blank">ArkUI实战</a>
      </li><li>
        <a href="https://space.bilibili.com/480883651" target="_blank">元服务开发实践</a>
      </li><li>
        <a href="https://blog.51cto.com/jianguo" target="_blank">OpenHarmony应用开发</a>
      </li>
    </ul>
  </div>

  <div class="book-summary">
    <div class="book-summary-title">文档目录</div>
     
    <nav role="navigation">


<ul class="summary">
    
    

    

    
        
        <li class="header">第一篇：总览与准备</li>
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../chapter1/跨平台框架总览.html">
            
                <a href="../chapter1/跨平台框架总览.html">
            
                    
                    跨平台框架总览（Flutter、RN、KMP、CMP、Qt、Electron、Cordova）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../chapter1/技术选型与对比.html">
            
                <a href="../chapter1/技术选型与对比.html">
            
                    
                    技术选型与对比（性能、生态、鸿蒙支持）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../chapter1/开发环境与工具.html">
            
                <a href="../chapter1/开发环境与工具.html">
            
                    
                    开发环境与工具（DevEco Studio、ArkUI、命令行）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../chapter1/架构与适配策略.html">
            
                <a href="../chapter1/架构与适配策略.html">
            
                    
                    架构与适配策略（Stage 模型、ArkUI 与各栈映射）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../chapter1/构建与发布流程总览.html">
            
                <a href="../chapter1/构建与发布流程总览.html">
            
                    
                    构建与发布流程总览
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">第二篇：Flutter 开发鸿蒙</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../chapter2/环境搭建与项目初始化.html">
            
                <a href="../chapter2/环境搭建与项目初始化.html">
            
                    
                    环境搭建与项目初始化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="../chapter2/鸿蒙适配指南.html">
            
                <a href="../chapter2/鸿蒙适配指南.html">
            
                    
                    鸿蒙适配指南（ArkUI 能力对接、Plugin 适配）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="../chapter2/原生能力桥接.html">
            
                <a href="../chapter2/原生能力桥接.html">
            
                    
                    原生能力桥接（权限、设备、文件、网络）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="../chapter2/UI导航与生命周期适配.html">
            
                <a href="../chapter2/UI导航与生命周期适配.html">
            
                    
                    UI/导航与生命周期适配
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="../chapter2/调试与性能优化.html">
            
                <a href="../chapter2/调试与性能优化.html">
            
                    
                    调试与性能优化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="../chapter2/实战案例与发布.html">
            
                <a href="../chapter2/实战案例与发布.html">
            
                    
                    实战案例与发布
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">第三篇：React Native 开发鸿蒙</li>
        
        
    
        <li class="chapter active" data-level="3.1" data-path="环境搭建与项目初始化.html">
            
                <a href="环境搭建与项目初始化.html">
            
                    
                    环境搭建与项目初始化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="鸿蒙适配指南.html">
            
                <a href="鸿蒙适配指南.html">
            
                    
                    鸿蒙适配指南（Bridge/Module 适配）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="原生能力桥接.html">
            
                <a href="原生能力桥接.html">
            
                    
                    原生能力桥接（权限、设备、文件、网络）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="UI导航与生命周期适配.html">
            
                <a href="UI导航与生命周期适配.html">
            
                    
                    UI/导航与生命周期适配
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="调试与性能优化.html">
            
                <a href="调试与性能优化.html">
            
                    
                    调试与性能优化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="实战案例与发布.html">
            
                <a href="实战案例与发布.html">
            
                    
                    实战案例与发布
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">第四篇：KMP/CMP 开发鸿蒙</li>
        
        
    
        <li class="chapter " data-level="4.1" >
            
                <span>
            
                    
                    KMP 共享模块设计与工程搭建
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="4.2" >
            
                <span>
            
                    
                    CMP UI 适配与组件封装
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="4.3" >
            
                <span>
            
                    
                    Harmony 原生能力交互（权限、设备、文件、网络）
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="4.4" >
            
                <span>
            
                    
                    测试、调试与性能优化
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="4.5" >
            
                <span>
            
                    
                    实战案例与发布
            
                </span>
            

            
        </li>
    

    
        
        <li class="header">第五篇：Qt 开发鸿蒙</li>
        
        
    
        <li class="chapter " data-level="5.1" >
            
                <span>
            
                    
                    环境搭建与工程配置
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="5.2" >
            
                <span>
            
                    
                    QML/Widget 与 ArkUI 能力映射
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="5.3" >
            
                <span>
            
                    
                    原生能力调用与平台适配
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="5.4" >
            
                <span>
            
                    
                    调试、性能与打包发布
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="5.5" >
            
                <span>
            
                    
                    实战案例
            
                </span>
            

            
        </li>
    

    
        
        <li class="header">第六篇：Electron 开发鸿蒙</li>
        
        
    
        <li class="chapter " data-level="6.1" >
            
                <span>
            
                    
                    环境搭建与工程创建
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="6.2" >
            
                <span>
            
                    
                    渲染进程与主进程适配策略
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="6.3" >
            
                <span>
            
                    
                    原生能力桥接（Node 原生模块 / Harmony 接口）
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="6.4" >
            
                <span>
            
                    
                    调试、性能与打包发布
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="6.5" >
            
                <span>
            
                    
                    实战案例
            
                </span>
            

            
        </li>
    

    
        
        <li class="header">第七篇：Cordova 开发鸿蒙</li>
        
        
    
        <li class="chapter " data-level="7.1" >
            
                <span>
            
                    
                    环境搭建与工程创建
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="7.2" >
            
                <span>
            
                    
                    插件开发与适配（Platform/Plugin）
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="7.3" >
            
                <span>
            
                    
                    原生能力调用（权限、设备、文件、网络）
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="7.4" >
            
                <span>
            
                    
                    调试、性能与打包发布
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="7.5" >
            
                <span>
            
                    
                    实战案例
            
                </span>
            

            
        </li>
    

    
        
        <li class="header">第八篇：通用适配与最佳实践</li>
        
        
    
        <li class="chapter " data-level="8.1" >
            
                <span>
            
                    
                    跨平台通用适配策略（路由、状态、资源）
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="8.2" >
            
                <span>
            
                    
                    性能与资源管理（包体积、启动速度、内存）
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="8.3" >
            
                <span>
            
                    
                    模块化与插件管理（多技术栈协作）
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="8.4" >
            
                <span>
            
                    
                    自动化构建与 CI/CD
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="8.5" >
            
                <span>
            
                    
                    发布到应用市场与灰度方案
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="8.6" >
            
                <span>
            
                    
                    质量保障与监控
            
                </span>
            

            
        </li>
    

    
        
        <li class="header">第九篇：附录</li>
        
        
    
        <li class="chapter " data-level="9.1" >
            
                <span>
            
                    
                    常见问题（FAQ）
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="9.2" >
            
                <span>
            
                    
                    术语表与概念索引
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="9.3" >
            
                <span>
            
                    
                    参考资料与链接
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="9.4" >
            
                <span>
            
                    
                    致谢
            
                </span>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>

</nav>
     
  </div>

  <!-- Content nav -->
  <div class="book-anchor">
    <div class="book-anchor-title"></div>

    <div class="book-anchor-body"></div>
  </div>

  <div class="book-body">
    
    <div class="body-inner">
       

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >环境搭建与项目初始化</a>
    </h1>
</div>



      <div class="page-wrapper" tabindex="-1" role="main">
        <div class="page-inner">
          
<div class="search-plus" id="book-search-results">
    <div class="search-noresults">
    
          <section class="normal markdown-section">
             
                <div id="container">
                    <!--
目的：指导使用 React Native 进行鸿蒙（HarmonyOS）开发的环境搭建与项目初始化。
内容结构：环境准备、工具安装、项目创建、集成与运行、常见问题与排错。
-->
<h1 id="&#x73AF;&#x5883;&#x642D;&#x5EFA;&#x4E0E;&#x9879;&#x76EE;&#x521D;&#x59CB;&#x5316;&#xFF08;react-native-&#x2192;-harmonyos&#xFF09;"><a name="&#x73AF;&#x5883;&#x642D;&#x5EFA;&#x4E0E;&#x9879;&#x76EE;&#x521D;&#x59CB;&#x5316;&#xFF08;react-native-&#x2192;-harmonyos&#xFF09;" class="plugin-anchor" href="#&#x73AF;&#x5883;&#x642D;&#x5EFA;&#x4E0E;&#x9879;&#x76EE;&#x521D;&#x59CB;&#x5316;&#xFF08;react-native-&#x2192;-harmonyos&#xFF09;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x73AF;&#x5883;&#x642D;&#x5EFA;&#x4E0E;&#x9879;&#x76EE;&#x521D;&#x59CB;&#x5316;&#xFF08;React Native &#x2192; HarmonyOS&#xFF09;</h1>
<h2 id="&#x73AF;&#x5883;&#x51C6;&#x5907;"><a name="&#x73AF;&#x5883;&#x51C6;&#x5907;" class="plugin-anchor" href="#&#x73AF;&#x5883;&#x51C6;&#x5907;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x73AF;&#x5883;&#x51C6;&#x5907;</h2>
<ul>
<li>&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#xFF1A;macOS / Windows / Linux&#xFF08;&#x5EFA;&#x8BAE;&#x6700;&#x65B0;&#x7A33;&#x5B9A;&#x7248;&#xFF09;</li>
<li>Node.js/npm &#x6216; Yarn&#xFF1A;&#x5EFA;&#x8BAE;&#x4F7F;&#x7528; Yarn &#x7BA1;&#x7406;&#x4F9D;&#x8D56;</li>
<li>React Native CLI &#x4E0E; Metro&#xFF08;&#x6253;&#x5305;&#x5668;&#xFF09;&#xFF1A;<code>npx react-native</code></li>
<li>DevEco Studio&#xFF1A;&#x7528;&#x4E8E;&#x9E3F;&#x8499;&#x5DE5;&#x7A0B;&#x7684;&#x6784;&#x5EFA;&#x3001;&#x7B7E;&#x540D;&#x4E0E;&#x8BBE;&#x5907;&#x8C03;&#x8BD5;</li>
<li>Git&#xFF1A;&#x7BA1;&#x7406;&#x5DE5;&#x7A0B;&#x4E0E;&#x9002;&#x914D;&#x6A21;&#x5757;</li>
</ul>
<h2 id="&#x5DE5;&#x5177;&#x5B89;&#x88C5;&#x4E0E;&#x68C0;&#x67E5;"><a name="&#x5DE5;&#x5177;&#x5B89;&#x88C5;&#x4E0E;&#x68C0;&#x67E5;" class="plugin-anchor" href="#&#x5DE5;&#x5177;&#x5B89;&#x88C5;&#x4E0E;&#x68C0;&#x67E5;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5DE5;&#x5177;&#x5B89;&#x88C5;&#x4E0E;&#x68C0;&#x67E5;</h2>
<ul>
<li>&#x5B89;&#x88C5; Node &#x4E0E; Yarn&#xFF1A;&#x53C2;&#x8003;&#x5B98;&#x7F51;&#x5B89;&#x88C5;&#x5E76;&#x914D;&#x7F6E; <code>PATH</code></li>
<li>&#x521B;&#x5EFA; RN &#x5DE5;&#x7A0B;&#xFF1A;<pre><code class="lang-bash">npx react-native init rnHarmonyDemo
<span class="hljs-built_in">cd</span> rnHarmonyDemo
</code></pre>
</li>
<li>&#x542F;&#x52A8; Metro&#xFF08;&#x5F00;&#x53D1;&#x670D;&#x52A1;&#xFF09;&#xFF1A;<pre><code class="lang-bash">npx react-native start
</code></pre>
</li>
</ul>
<h2 id="&#x96C6;&#x6210;&#x9E3F;&#x8499;&#x5E73;&#x53F0;&#xFF08;&#x6982;&#x5FF5;&#x4E0E;&#x6B65;&#x9AA4;&#x63D0;&#x793A;&#xFF09;"><a name="&#x96C6;&#x6210;&#x9E3F;&#x8499;&#x5E73;&#x53F0;&#xFF08;&#x6982;&#x5FF5;&#x4E0E;&#x6B65;&#x9AA4;&#x63D0;&#x793A;&#xFF09;" class="plugin-anchor" href="#&#x96C6;&#x6210;&#x9E3F;&#x8499;&#x5E73;&#x53F0;&#xFF08;&#x6982;&#x5FF5;&#x4E0E;&#x6B65;&#x9AA4;&#x63D0;&#x793A;&#xFF09;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x96C6;&#x6210;&#x9E3F;&#x8499;&#x5E73;&#x53F0;&#xFF08;&#x6982;&#x5FF5;&#x4E0E;&#x6B65;&#x9AA4;&#x63D0;&#x793A;&#xFF09;</h2>
<ul>
<li>&#x57FA;&#x672C;&#x601D;&#x8DEF;&#xFF1A;&#x5728; RN &#x5DE5;&#x7A0B;&#x4E2D;&#x5F15;&#x5165;&#x9E3F;&#x8499;&#x539F;&#x751F;&#x4FA7;&#x5DE5;&#x7A0B;&#xFF08;ArkTS/Java/C++&#xFF09;&#x4E0E;&#x6865;&#x63A5;&#x5C42;&#xFF0C;&#x6784;&#x5EFA; HAP &#x5B89;&#x88C5;&#x81F3;&#x8BBE;&#x5907;</li>
<li>&#x53C2;&#x8003;&#x9002;&#x914D;&#x4ED3;&#x5E93;&#x63D0;&#x4F9B;&#x7684;&#x6A21;&#x677F;/&#x811A;&#x672C;&#xFF0C;&#x5C06; <code>Native Module</code> &#x4E0E; <code>UI Component</code> &#x5BF9;&#x63A5;&#x81F3; RN &#x7684;&#x6865;&#x63A5;&#x5C42;&#xFF08;JS &#x2194; &#x539F;&#x751F;&#xFF09;&#xFF08;TurboModule/JSI &#x6216;&#x4F20;&#x7EDF; Bridge&#xFF09;</li>
<li>&#x5728; DevEco Studio &#x4E2D;&#x914D;&#x7F6E;&#xFF1A;&#x7B7E;&#x540D;&#x8BC1;&#x4E66;&#x3001;&#x6743;&#x9650;&#x3001;&#x8BBE;&#x5907;&#x8FDE;&#x63A5;&#xFF1B;&#x5C06;&#x751F;&#x6210;&#x7684; HAP &#x90E8;&#x7F72;&#x5230;&#x9E3F;&#x8499;&#x8BBE;&#x5907;</li>
</ul>
<h2 id="&#x8FD0;&#x884C;&#x4E0E;&#x8BBE;&#x5907;&#x8FDE;&#x63A5;"><a name="&#x8FD0;&#x884C;&#x4E0E;&#x8BBE;&#x5907;&#x8FDE;&#x63A5;" class="plugin-anchor" href="#&#x8FD0;&#x884C;&#x4E0E;&#x8BBE;&#x5907;&#x8FDE;&#x63A5;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x8FD0;&#x884C;&#x4E0E;&#x8BBE;&#x5907;&#x8FDE;&#x63A5;</h2>
<ul>
<li>Metro &#x4FDD;&#x6301;&#x8FD0;&#x884C;&#xFF1B;&#x5728;&#x9E3F;&#x8499;&#x4FA7;&#x5B89;&#x88C5;&#x5E76;&#x542F;&#x52A8;&#x5E94;&#x7528;&#x540E;&#xFF0C;RN &#x7684; JS Bundle &#x7531; Metro &#x63D0;&#x4F9B;&#xFF08;&#x6216;&#x6253;&#x5305;&#x4E3A;&#x79BB;&#x7EBF; Bundle&#xFF09;</li>
<li>&#x771F;&#x673A;&#x8C03;&#x8BD5;&#x4F18;&#x5148;&#xFF1A;&#x786E;&#x4FDD;&#x8BBE;&#x5907; USB &#x8C03;&#x8BD5;&#x5F00;&#x542F;&#xFF0C;DevEco &#x8BBE;&#x5907;&#x7BA1;&#x7406;&#x53EF;&#x8BC6;&#x522B;</li>
</ul>
<h2 id="&#x6743;&#x9650;&#x4E0E;&#x7B7E;&#x540D;&#xFF08;&#x793A;&#x4F8B;&#x4E0E;&#x8BF4;&#x660E;&#xFF09;"><a name="&#x6743;&#x9650;&#x4E0E;&#x7B7E;&#x540D;&#xFF08;&#x793A;&#x4F8B;&#x4E0E;&#x8BF4;&#x660E;&#xFF09;" class="plugin-anchor" href="#&#x6743;&#x9650;&#x4E0E;&#x7B7E;&#x540D;&#xFF08;&#x793A;&#x4F8B;&#x4E0E;&#x8BF4;&#x660E;&#xFF09;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x6743;&#x9650;&#x4E0E;&#x7B7E;&#x540D;&#xFF08;&#x793A;&#x4F8B;&#x4E0E;&#x8BF4;&#x660E;&#xFF09;</h2>
<ul>
<li>&#x5728;&#x9E3F;&#x8499;&#x539F;&#x751F;&#x5DE5;&#x7A0B;&#x7684; <code>module.json5</code> &#x4E2D;&#x58F0;&#x660E;&#x6240;&#x9700;&#x6743;&#x9650;&#xFF08;&#x5982; <code>INTERNET</code>&#x3001;&#x5B58;&#x50A8;&#x8BFB;&#x5199;&#xFF09;<pre><code class="lang-json">{
<span class="hljs-string">&quot;module&quot;</span>: {
  <span class="hljs-string">&quot;name&quot;</span>: <span class="hljs-string">&quot;entry&quot;</span>,
  <span class="hljs-string">&quot;requestPermissions&quot;</span>: [
    { <span class="hljs-string">&quot;name&quot;</span>: <span class="hljs-string">&quot;ohos.permission.INTERNET&quot;</span> },
    { <span class="hljs-string">&quot;name&quot;</span>: <span class="hljs-string">&quot;ohos.permission.READ_MEDIA&quot;</span> },
    { <span class="hljs-string">&quot;name&quot;</span>: <span class="hljs-string">&quot;ohos.permission.WRITE_MEDIA&quot;</span> }
  ]
}
}
</code></pre>
</li>
<li>&#x4F7F;&#x7528; DevEco Studio &#x751F;&#x6210;&#x7B7E;&#x540D;&#x5E76;&#x6253;&#x5305; HAP&#xFF1B;&#x5B89;&#x88C5;&#x5230;&#x8BBE;&#x5907;&#x540E;&#x8FDB;&#x884C;&#x529F;&#x80FD;&#x9A8C;&#x8BC1;</li>
</ul>
<h2 id="&#x5E38;&#x89C1;&#x95EE;&#x9898;&#x4E0E;&#x6392;&#x9519;"><a name="&#x5E38;&#x89C1;&#x95EE;&#x9898;&#x4E0E;&#x6392;&#x9519;" class="plugin-anchor" href="#&#x5E38;&#x89C1;&#x95EE;&#x9898;&#x4E0E;&#x6392;&#x9519;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5E38;&#x89C1;&#x95EE;&#x9898;&#x4E0E;&#x6392;&#x9519;</h2>
<ul>
<li>Metro &#x65E0;&#x6CD5;&#x8FDE;&#x63A5;&#xFF1A;&#x68C0;&#x67E5;&#x8BBE;&#x5907;&#x4E0E;&#x5BBF;&#x4E3B;&#x7F51;&#x7EDC;&#x3001;&#x7AEF;&#x53E3;&#x3001;&#x9632;&#x706B;&#x5899;&#xFF1B;&#x5C1D;&#x8BD5;&#x751F;&#x6210;&#x79BB;&#x7EBF; Bundle</li>
<li>&#x6743;&#x9650;&#x4E0D;&#x8DB3;&#xFF1A;&#x786E;&#x8BA4; <code>module.json5</code> &#x7684;&#x58F0;&#x660E;&#x5E76;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x5B8C;&#x6210;&#x6388;&#x6743;</li>
<li>&#x8D44;&#x6E90;&#x4E0E;&#x8DEF;&#x5F84;&#xFF1A;&#x786E;&#x4FDD;&#x4F7F;&#x7528;&#x5E94;&#x7528;&#x6C99;&#x7BB1;&#x8DEF;&#x5F84;&#x4E0E;&#x517C;&#x5BB9;&#x7684;&#x8D44;&#x6E90;&#x76EE;&#x5F55;&#x7ED3;&#x6784;</li>
<li>&#x6865;&#x63A5;&#x5F02;&#x5E38;&#xFF1A;&#x6838;&#x5BF9;&#x65B9;&#x6CD5;&#x540D;&#x3001;&#x7EBF;&#x7A0B;&#x6A21;&#x578B;&#x4E0E;&#x8FD4;&#x56DE;&#x7C7B;&#x578B;&#xFF0C;&#x786E;&#x4FDD;&#x4E0E; JS &#x4FA7;&#x7EA6;&#x5B9A;&#x4E00;&#x81F4;</li>
</ul>
<h2 id="&#x4E0B;&#x4E00;&#x6B65;"><a name="&#x4E0B;&#x4E00;&#x6B65;" class="plugin-anchor" href="#&#x4E0B;&#x4E00;&#x6B65;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4E0B;&#x4E00;&#x6B65;</h2>
<ul>
<li>&#x7EE7;&#x7EED;&#x9605;&#x8BFB;&#xFF1A;<code>&#x9E3F;&#x8499;&#x9002;&#x914D;&#x6307;&#x5357;&#xFF08;Bridge/Module &#x9002;&#x914D;&#xFF09;</code> &#x4E0E; <code>&#x539F;&#x751F;&#x80FD;&#x529B;&#x6865;&#x63A5;&#xFF08;&#x6743;&#x9650;&#x3001;&#x8BBE;&#x5907;&#x3001;&#x6587;&#x4EF6;&#x3001;&#x7F51;&#x7EDC;&#xFF09;</code> </li>
</ul>
<footer class="page-footer"><span class="copyright">powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2025-11-10 12:29:35
</span></footer>
<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style>
                </div>
                <script src="https://blog.snowdreams1006.cn/assets/js/readmore.js" type="text/javascript"></script>
                <script>
                    var btw = new BTWPlugin();
                    btw.init({"blogId":"27976-1678928361372-483","name":"坚果派","qrcode":"https://luckly007.oss-cn-beijing.aliyuncs.com/images/image-20230316085818226.png","keyword":"鸿蒙坚果"});
                </script>
                 
          </section>
          
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>
 
          <div class="book-footer">
            
            <div class="donate">
              <div></div>
              <button class="donate-btn" onclick="showModal()">赞赏</button>
            </div>
             
            <div class="copyright"></div>
            
          </div>
          
        </div>
      </div>
      
    </div>

     
    <a
      href="../chapter2/实战案例与发布.html"
      class="navigation navigation-prev "
      aria-label="Previous page: 实战案例与发布"
    >
      <i class="fa fa-angle-left"></i>
    </a>
     
    <a
      href="鸿蒙适配指南.html"
      class="navigation navigation-next "
      aria-label="Next page: 鸿蒙适配指南（Bridge/Module 适配）"
    >
      <i class="fa fa-angle-right"></i>
    </a>
      
  </div>
  <script>
    function showModal() {
      document.getElementsByClassName("mask")[0].style.display = "block";
      document.getElementsByClassName("donate-modal")[0].style.display =
        "block";
    }
    // 切换赞赏码
    function showDonateImg(num) {
      let alipay = "";
      let wxpay = ""
      if(num){
        wxpay = "hidden"
      }else{
        alipay = "hidden"
      }
      document.getElementById("wxpay-code").hidden = wxpay;
      document.getElementById("alipay-code").hidden = alipay;
      document.getElementsByName("pay-way")[num].checked = "checked";
    }

    // 关闭赞赏框
    function closeDonateModal() {
      document.getElementsByClassName("mask")[0].style.display = "none";
      document.getElementsByClassName("donate-modal")[0].style.display = "none";
    }

    var gitbook = gitbook || [];
    gitbook.push(function () {
      gitbook.page.hasChanged({"page":{"title":"环境搭建与项目初始化","level":"3.1","depth":1,"next":{"title":"鸿蒙适配指南（Bridge/Module 适配）","level":"3.2","depth":1,"path":"chapter3/鸿蒙适配指南.md","ref":"./chapter3/鸿蒙适配指南.md","articles":[]},"previous":{"title":"实战案例与发布","level":"2.6","depth":1,"path":"chapter2/实战案例与发布.md","ref":"./chapter2/实战案例与发布.md","articles":[]},"dir":"ltr"},"config":{"plugins":["github-buttons@2.1.0","edit-link","splitter","tbfed-pagefooter","expandable-chapters","chapter-fold","back-to-top-button","code","pageview-count","popup","search-plus","-lunr","-search","splitter","-sharing","sharing-plus","theme-lou","mind-maps","emphasize","anchors","changyan","readmore","livereload","ace","livereload"],"root":".","styles":{"website":"styles/website.css"},"pluginsConfig":{"tbfed-pagefooter":{"modify_label":"该文件修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"chapter-fold":{},"pluginsConfig":{"expandable-chapters":{}},"emphasize":{},"ace":{},"livereload":{},"splitter":{},"readmore":{"blogId":"27976-1678928361372-483","name":"坚果派","qrcode":"https://luckly007.oss-cn-beijing.aliyuncs.com/images/image-20230316085818226.png","keyword":"鸿蒙坚果"},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"popup":{},"code":{"copyButtons":true},"theme-lou":{"hide-elements":[".summary .gitbook-link",".summary .divider"],"color":"#FF4848","book-anchor-title":"本章目录","copyright":{"author":"vx:nut_pie"},"forbidCopy":true,"logo":"assets/avatar.png","book-summary-title":"文章目录","search-placeholder":"输入关键字搜索","copyrightLogo":"assets/copyright.png","favicon":"assets/avatar.png","appleTouchIconPrecomposed152":"assets/avatar.png"},"changyan":{"appid":"cyvHoCPAs","conf":"0440cfc4168ba95d73cfc52dd4d5c60b"},"fontsettings":{"theme":"white","family":"sans","size":2},"mind-maps":{},"highlight":{},"back-to-top-button":{},"pageview-count":{},"github-buttons":{"repo":"ITmxs/gitbook","types":["star","watch","fork"],"size":"small"},"sharing":{"qq":false,"all":["qq","qzone","whatsapp","douban","facebook","google","instapaper","linkedin","messenger","twitter","weibo"],"douban":false,"facebook":false,"weibo":false,"twitter":false,"pocket":false,"google":false,"qzone":false},"edit-link":{"label":"编辑此页","base":"https://github.com/ITmxs/gitbook/edit/master/"},"theme-default":{"styles":{"pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css","website":"styles/website.css"},"showLevel":false},"anchors":{},"expandable-chapters":{},"search-plus":{}},"theme":"default","author":"坚果派","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{"themeLou":{"nav":[{"target":"_blank","url":"https://www.nutpie.net/","name":"坚果派官网"},{"target":"_blank","url":"https://www.npmjs.com/package/package","name":"ArkUI实战"},{"target":"_blank","url":"https://space.bilibili.com/480883651","name":"元服务开发实践"},{"target":"_blank","url":"https://blog.51cto.com/jianguo","name":"OpenHarmony应用开发"}],"footer":{"donate":{"wechat":"https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210922202901895.png","message":"随意打赏，但不要超过一顿早餐钱 💕","wxpay":"https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210922202901895.png","alipay":"https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210922202843746.png","nickname":"breeze","button":"打赏","wechatText":"微信","alipayText":"支付宝","title":"『赠人玫瑰 🌹 手有余香 』","avatar":"http://xkapp-uat.oss-cn-hangzhou.aliyuncs.com/2e7a3f70-80ab-4b50-93ec-a04dfeef949b/avatar-100.png"},"copyright":true}}},"title":"开源鸿蒙跨平台开发教程","language":"zh-hans","gitbook":"*","description":"开源鸿蒙跨平台开发电子书教程"},"file":{"path":"chapter3/环境搭建与项目初始化.md","mtime":"2025-11-10T04:29:35.043Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2025-11-10T05:42:35.446Z"},"basePath":"..","book":{"language":""}});
    });
  </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-github-buttons/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-edit-link/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-pageview-count/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-mind-maps/mindmaps.dist.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-changyan/changyan.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-ace/ace/ace.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-ace/ace.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-theme-lou/jweixin-1.6.0.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-theme-lou/lou.js"></script>
        
    

    </body>
</html>

